﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StringCalc;

namespace UnitTests
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            StringCalc.Calculator calc = new Calculator();
            int emptyResult = calc.add("");
            int oneResult = calc.add("8");
            int twoResult = calc.add("1,7");
            Assert.AreEqual(emptyResult, -1);
            Assert.AreEqual(oneResult, 8);
            Assert.AreEqual(twoResult, 8);
        }

        [TestMethod]
        public void TestMethod2()
        {
            StringCalc.Calculator calc = new Calculator();
            Assert.AreEqual(calc.add("1\n2,3"), 6);
        }

        [TestMethod]
        public void TestMethod3()
        {
            StringCalc.Calculator calc = new Calculator();
            Assert.AreEqual(calc.add("//*\n5*4*2"), 11);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void TestMethod4()
        {
            StringCalc.Calculator calc = new Calculator();
            calc.add("-1");
        }
    }
}
